import request from '@/utils/request'


export default {
  getTestTitleList(searchModel) {
    return request({
      url: '/test/list',
      method: 'get',
      params: {
        pageNo: searchModel.pageNo,
        pageSize: searchModel.pageSize
      }
    })
  },
  getExamTitleList(searchModel) {
    return request({
      url: '/test/exam',
      method: 'get',
      params: {
        pageNo: searchModel.pageNo,
        pageSize: searchModel.pageSize
      }
    })
  },
  getExamHistoryList(searchModel) {
    return request({
      url: '/test/exam_history',
      method: 'get',
      params: {
        pageNo: searchModel.pageNo,
        pageSize: searchModel.pageSize,
        key: searchModel.key
      }
    })
  },
  startTestById(id) {
    return request({
      // url: '/user' + id,
      url: `/test/${id}`,
      method: 'get',
    })
  },
  submitExam(exam) {
    return request({
      url: '/test',
      method: 'post',
      data: exam
    })
  },
  startExamById(id) {
    return request({
      // url: '/user' + id,
      url: `/test/exam/${id}`,
      method: 'get',
    })
  },
  submitFlyExam(exam) {
    return request({
      url: '/test/exam',
      method: 'post',
      data: exam
    })
  },
  getExamineeAnswerById(id) {
    return request({
      // url: '/user' + id,
      url: `/test/examinee/answer/${id}`,
      method: 'get',
    })
  },
  submitCorrection(exam) {
    return request({
      url: '/test/exam/correction',
      method: 'post',
      data: exam
    })
  },
  deleteExamById(id) {
    return request({
      // url: '/user' + id,
      url: `/test/exam/${id}`,
      method: 'delete',
    })
  },
  // addUser(user) {
  //   return request({
  //     url: '/user',
  //     method: 'post',
  //     data: user
  //   })
  // },
  // updateUser(user) {
  //   return request({
  //     url: '/user',
  //     method: 'put',
  //     data: user
  //   })
  // },
  // saveUser(user) {
  //   if (user.id == null || user.id == undefined) {
  //     return this.addUser(user);
  //   }
  //   return this.updateUser(user);
  // },
  // getUserById(id) {
  //   return request({
  //     // url: '/user' + id,
  //     url: `/user/${id}`,
  //     method: 'get',
  //   })
  // },
  // deleteUserById(id) {
  //   return request({
  //     // url: '/user' + id,
  //     url: `/user/${id}`,
  //     method: 'delete',
  //   })
  // }
}
